package e

const (
	SUCCESS       = 200
	ERROR         = 500
	InvalidParams = 400

	ErrorCheckSignFail         = 20000
	ErrorAuthCheckTokenFail    = 20001
	ErrorAuthCheckTokenTimeout = 20002
	ErrorAuthToken             = 20003
	ErrorAuth                  = 20004

	ErrorAuthPermissionToken = 10001
	ErrorCreateUserFail      = 10002
	ErrorSaveUserInfoFail    = 10003
	ErrorCountUserFail       = 10004

	//文章
	ErrorNotExistArticle       = 10011
	ErrorCheckExistArticleFail = 10012
	ErrorAddArticleFail        = 10013
	ErrorDeleteArticleFail     = 10014
	ErrorEditArticleFail       = 10015
	ErrorCountArticleFail      = 10016
	ErrorGetArticlesFail       = 10017
	ErrorGetArticleFail        = 10018
	ErrorGenArticlePosterFail  = 10019

	ErrorGetHotKeysFail = 10111

	//藏经
	ErrorNotExistSutra        = 10211
	ErrorCheckExistSutraFail  = 10212
	ErrorAddSutraFail         = 10213
	ErrorDeleteSutraFail      = 10214
	ErrorEditSutraFail        = 10215
	ErrorCountSutraFail       = 10216
	ErrorGetSutrasFail        = 10217
	ErrorGetSutraFail         = 10218
	ErrorGenSutraPosterFail   = 10219
	ErrorGetSutraChaptersFail = 10220
	ErrorGetSutraChapterFail  = 10221
	ErrorAddSutraChapterFail  = 10222

	//梵音
	ErrorGetPlaylistFail      = 10318
	ErrorGenMusicPosterFail   = 10319
	ErrorGetPlaylistAudioFail = 10320
	ErrorGetAudioFail         = 10321

	//箴言
	ErrorNotExistProverb       = 10411
	ErrorCheckExistProverbFail = 10412
	ErrorAddProverbFail        = 10413
	ErrorDeleteProverbFail     = 10414
	ErrorEditProverbFail       = 10415
	ErrorCountProverbFail      = 10416
	ErrorGetProverbsFail       = 10417
	ErrorGetProverbFail        = 10418
	ErrorGenProverbPosterFail  = 10419

	ErrorCoinNotEnough     = 10711
	ErrorCoinAwardFail     = 10712
	ErrorExpAwardFail      = 10713
	ErrorPrestigeNotEnough = 10714
	ErrorPrestigeAwardFail = 10715

	ErrorAlreadySignIn = 10811
	ErrorSignInFail    = 10822
	ErrorZazenFail     = 10823
	ErrorIncenseFail   = 10824

	ErrorUploadSaveImageFail    = 30001
	ErrorUploadCheckImageFail   = 30002
	ErrorUploadCheckImageFormat = 30003
)

var MsgFlags = map[int]string{
	SUCCESS:       "ok",
	ERROR:         "fail",
	InvalidParams: "请求参数错误",

	ErrorAuthCheckTokenFail:    "Token鉴权失败",
	ErrorAuthCheckTokenTimeout: "Token已过期",
	ErrorAuthToken:             "Token生成失败",
	ErrorAuth:                  "用户鉴权错误",

	ErrorAuthPermissionToken: "用户无操作权限",
	ErrorCheckSignFail:       "Sign验签失败",
	ErrorCreateUserFail:      "创建用户失败",
	ErrorSaveUserInfoFail:    "保存用户信息失败",
	ErrorCountUserFail:       "统计用户失败",

	ErrorNotExistArticle:       "该文章不存在",
	ErrorAddArticleFail:        "新增文章失败",
	ErrorDeleteArticleFail:     "删除文章失败",
	ErrorCheckExistArticleFail: "检查文章是否存在失败",
	ErrorEditArticleFail:       "修改文章失败",
	ErrorCountArticleFail:      "统计文章失败",
	ErrorGetArticlesFail:       "获取多个文章失败",
	ErrorGetArticleFail:        "没有找到该文章",
	ErrorGenArticlePosterFail:  "生成文章海报失败",

	ErrorGetHotKeysFail: "获取多个热键失败",

	ErrorNotExistSutra:        "该经咒不存在",
	ErrorCheckExistSutraFail:  "检查经咒是否存在失败",
	ErrorAddSutraFail:         "新增经咒失败",
	ErrorDeleteSutraFail:      "删除经咒失败",
	ErrorEditSutraFail:        "修改经咒失败",
	ErrorCountSutraFail:       "统计经咒失败",
	ErrorGetSutrasFail:        "没有找到佛经",
	ErrorGetSutraFail:         "佛经查询失败",
	ErrorGenSutraPosterFail:   "生成经咒海报失败",
	ErrorGetSutraChaptersFail: "没有找到章回",
	ErrorGetSutraChapterFail:  "章回查询失败",
	ErrorAddSutraChapterFail:  "新增经咒章回失败",

	ErrorGetPlaylistFail:      "歌单列表获取失败",
	ErrorGenMusicPosterFail:   "生成音乐海报失败",
	ErrorGetPlaylistAudioFail: "歌单音乐列表失败",
	ErrorGetAudioFail:         "音频获取失败",

	ErrorNotExistProverb:       "箴言不存在",
	ErrorCheckExistProverbFail: "检查箴言异常",
	ErrorAddProverbFail:        "新增箴言失败",
	ErrorDeleteProverbFail:     "删除箴言失败",
	ErrorEditProverbFail:       "修改箴言失败",
	ErrorCountProverbFail:      "获取箴言数量失败",
	ErrorGetProverbsFail:       "获取箴言列表失败",
	ErrorGetProverbFail:        "获取箴言详情失败",
	ErrorGenProverbPosterFail:  "生成箴言海报失败",

	ErrorCoinAwardFail:     "佛缘奖励失败",
	ErrorCoinNotEnough:     "佛缘不足扣除",
	ErrorPrestigeAwardFail: "声望奖励失败",
	ErrorPrestigeNotEnough: "声望不足扣除",
	ErrorExpAwardFail:      "经验奖励失败",

	ErrorAlreadySignIn: "已经签到过",
	ErrorSignInFail:    "签到失败",
	ErrorZazenFail:     "下座失败",
	ErrorIncenseFail:   "敬香失败",

	ErrorUploadSaveImageFail:    "保存图片失败",
	ErrorUploadCheckImageFail:   "检查图片失败",
	ErrorUploadCheckImageFormat: "校验图片错误，图片格式或大小有问题",
}

// GetMsg get error information based on Code
func GetMsg(code int) string {
	msg, ok := MsgFlags[code]
	if ok {
		return msg
	}

	return MsgFlags[ERROR]
}
